image: {{ .ModuleName }}/{{ .ImageName }}
fromImage: common/distroless
docker:
  ENV:
    WORKDIR: /
    ENTRYPOINT: "/machine-controller-manager"
import:
- artifact: {{ .ModuleName }}/{{ .ImageName }}/build
  add: /src/machine-controller-manager
  to: /machine-controller-manager
  before: setup
---
artifact: {{ .ModuleName }}/{{ .ImageName }}/build
from: {{ .Images.BASE_GOLANG_20_ALPINE }}
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  install:
  - apk add git
  setup:
  - mkdir /src && cd /src
  - git clone --depth 1 --branch v0.36.0-flant.15 {{ $.SOURCE_REPO }}/deckhouse/mcm.git .
  - GOPROXY={{ $.GOPROXY }} CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=vendor -o machine-controller-manager cmd/machine-controller-manager/controller_manager.go
  - chown 64535:64535 machine-controller-manager
  - chmod 0700 machine-controller-manager
